package top.kaoshanji.q1ch06b.main;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import top.kaoshanji.q1ch06b.config.ProjectConfig;
import top.kaoshanji.q1ch06b.model.Comment;
import top.kaoshanji.q1ch06b.services.CommentService;

import java.util.logging.Logger;

/**
 * 代码清单-q1ch06b-123页a：打印返回值，观察切面的行为
 * @author kaoshanji
 * ^_^
 * create time 2025/4/29 10:09
 */
public class Main {

    private static Logger logger = Logger.getLogger(Main.class.getName());

    public static void main(String[] args) {

        var context = new AnnotationConfigApplicationContext(ProjectConfig.class);

        var service = context.getBean(CommentService.class);

        Comment comment = new Comment();
        comment.setText("Demo comment");
        comment.setAuthor("Natasha");

        String value = service.publishComment(comment);

        logger.info("方法执行的结果：" + value);

    }

}
